import React from 'react';
import { observer, inject } from 'mobx-react';
import ReplyBase, { ReplyProps } from './reply';
import $ from "jquery";
import {WeaTools} from 'ecCom';
const getParent = WeaTools.WindowFunc.getParent;

@inject("reply")
@observer
export default class Reply extends React.Component<ReplyProps, any> {
    componentWillMount() {
        const { reply } = this.props;
        reply.initReply();
    }
    componentDidMount() {
        this.setIframeHeight();
    }
    componentDidUpdate() {
        this.setIframeHeight();
    }
    setIframeHeight = () => {
        $('#tabcontentframe', getParent()).height($('.cube-reply').height()).parent().height($('.cube-reply').height());
    }
    render() {
        return (
            <div style={{ height: '100%', overflowY: 'auto' }}>
                <div style={{ paddingTop: 25, background: '#f1f1f1' }} >
                    <ReplyBase {...this.props} />
                </div>
            </div>
        )
    }
}